﻿
@{
    ViewBag.Title = "图纸会审修改";
}

<link href="~/Resource/css/ProjectManagement.css" rel="stylesheet" />

<style>
    .btn-pro {
        width: 15%;
        height: 35px;
        border: none;
        background-color: #6a6969;
        color: #fff;
    }

    .timeGroup {
        width: 100%;
        display: inline-block;
        position: relative;
    }

        .timeGroup > i {
            position: absolute;
            top: 9px;
            right: 6px;
        }
</style>

<div class="contentData">
    <form class="form-horizontal" id="mainForm">
        <div class="module-div">
            <h4>项目基本信息</h4>
            <table class="datalist" style="word-break:break-all;word-wrap:break-word;margin-top:10px;">
                <tbody>
                    <tr>
                        <td class="table_title">项目名称：</td>
                        <td class="td-div" colspan="3">
                            <div>
                                <input class="form-control input_unit" type="text" id="ProjectId" name="ProjectId" value="" />
                                <input class="btn-pro" type="button" name="name" value="选择项目" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="table_title">站库名称：</td>
                        <td class="td-div">
                            <div></div>
                        </td>
                        <td class="table_title">项目性质：</td>
                        <td class="td-div">
                            <div></div>
                        </td>
                    </tr>
                    <tr>
                        <td class="table_title">项目类型：</td>
                        <td class="td-div">
                            <div></div>
                        </td>
                        <td class="table_title">项目编号：</td>
                        <td class="td-div">
                            <div></div>
                        </td>
                    </tr>
                    <tr>
                        <td class="table_title">地区公司：</td>
                        <td class="td-div">
                            <div></div>
                        </td>
                        <td class="table_title">地市公司：</td>
                        <td class="td-div">
                            <div></div>
                        </td>
                    </tr>
                    <tr>
                        <td class="table_title">估算投资：</td>
                        <td class="td-div">
                            <div></div>
                        </td>
                        <td class="table_title">工程费用：</td>
                        <td class="td-div">
                            <div></div>
                        </td>
                    </tr>
                    <tr>
                        <td class="table_title">土地费用：</td>
                        <td class="td-div">
                            <div></div>
                        </td>
                        <td class="table_title">其他费用：</td>
                        <td class="td-div">
                            <div> </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="module-div">
            <h4>加油站施工图会审</h4>
            <table class="datalist" style="word-break:break-all;word-wrap:break-word;margin-top:10px;">
                <tbody>
                    <tr>
                        <td class="table_title">
                            <span>评审时间：</span>
                        </td>
                        <td class="td-div">
                            <div class="timeGroup">
                                <input type="text" class="form-control" id="startTime" name="startTime" value="" onfocus=this.blur() onClick="WdatePicker({ onpicked: function (dp) { $('#endTime').val(''); }})" placeholder="年-月-日">
                                <i onClick="WdatePicker({ el: 'startTime' })" class="iconfont pic">&#xe7e2;</i>
                            </div>
                        </td>
                        <td class="table_title">
                            <span>主持人：</span>
                        </td>
                        <td class="td-div">
                            <div class="form-group">
                                <input type="text" name="Address" class="form-control" placeholder="" value="" />
                            </div>
                        </td>
                    </tr>

                    <tr>
                        <td class="table_title">
                            <span>评审地点：</span>
                        </td>
                        <td class="td-div" colspan="3">
                            <div class="form-group">
                                <input type="text" name="Address" class="form-control" placeholder="" value="" />
                            </div>
                        </td>
                    </tr>

                    <tr>
                        <td class="table_title">
                            <span>特邀专家：</span>
                        </td>
                        <td class="td-div" colspan="3">
                            <div class="form-group">
                                <textarea class="form-control" style="resize:none;"></textarea>
                            </div>
                        </td>
                    </tr>

                    <tr>
                        <td class="table_title">
                            <span>参会人员：</span>
                        </td>
                        <td class="td-div" colspan="3">
                            <div class="form-group">
                                <textarea class="form-control" style="resize:none;"></textarea>
                            </div>
                        </td>
                    </tr>

                    <tr>
                        <td class="table_title">
                            <span>评审结论：</span>
                        </td>
                        <td class="td-div" colspan="3">
                            <label class="radio-inline">
                                <input type="radio" name="SalesRealizability" value="XIAOLKSX1" checked />同意
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="SalesRealizability" value="XIAOLKSX2" />原则同意
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="SalesRealizability" value="XIAOLKSX3" />不同意
                            </label>
                        </td>
                    </tr>

                </tbody>
            </table>
        </div>

        <div class="module-div">
            <h4>附件上传</h4>
            <table class="datalist fileShow" style="word-break:break-all;word-wrap:break-word;margin-top:10px;">
                <tbody class="fileShow-append">
                    <tr class="headtr">
                        <td style="width:220px;">附件类型</td>
                        <td class="td-div" style="width: 409px!important;">
                            <select class="form-control" id="fileType">
                                @*id="fileType"后面要根据数据库的字段改*@
                                <option value="value">会议纪要</option>
                                <option value="value">其他资料</option>
                            </select>
                            <input id="FileType" type="hidden" name="FileType" value="" />
                        </td>
                        <td class="table_title" style="text-align:left;">
                            <div class="btn-upload">
                                <input type="button" id="btnUploadFile1" class="btnUploadFile btn  form-control" style="position: relative; z-index: 1;width: 100px;font-size: 16px; background-color:#c3c3c3!important;color:white;" value="选择附件" />
                                <input type="file" id="loadFile1" name="loadFile1" style="display:none!important" onchange="uploadFile1()">
                                <span style="vertical-align:bottom; margin-left:15px; color:#B7B7B7;"></span>
                            </div>
                            <input type="hidden" name="fileDataJsonFile" id="fileDataJsonFile">
                        </td>
                        <td class="td-div"><div class="color_red text_lf">附件类型仅支持：doc,pdf,excel,ppt,png等</div></td>
                    </tr>
                    <tr class="headtr">
                        <th class="table_title" style="width: 219px;">序号</th>
                        <th class="td-div">附件名称</th>
                        <th class="table_title">附件类型</th>
                        <th class="td-div">操作</th>
                    </tr>
                </tbody>
            </table>

        </div>

        <div class="layui-form-item  btn-save" style="margin-top:60px;text-align:center;">
            <input type="button" lay-submit lay-filter="sub" value="暂&nbsp;&nbsp;&nbsp;存" class="layui-btn layui-btn-big save" data-state="" />
            <input type="button" lay-submit lay-filter="sub" value="提&nbsp;&nbsp;&nbsp;交" class="layui-btn layui-btn-big save" data-state="" />
            <input type="button" id="Cancel" value="取&nbsp;&nbsp;&nbsp;消" class="layui-btn layui-btn-big " />
            <input type="hidden" name="State" id="State" />
        </div>
    </form>
</div>

<script>
    $("#Cancel").on("click", function () {
        window.location.href = "/ProjectManagement/ConstructionDrawings";
    });

    //删除附件
    $("body").on('click', '.fileDel', function () {
        $(this).parents("tr").remove();
    });

    $('#btnUploadFile1').click(function () {
        document.getElementById("loadFile1").click();
    });

    $("#Cancel").on("click", function () {
        window.location.href = "/ProjectManagement/ProjectManagementList";
    });
    function uploadFile1() {
        var fileObj = document.getElementById("loadFile1").files[0]; // js 获取文件对象
        var formFile = new FormData();
        formFile.append("file", fileObj);
        var path = formFile;

        $.ajax({
            url: "/Upload/UploadHB",
            type: "POST",
            data: path,
            contentType: false,
            processData: false,
            success: function (data) {
                for (var i = 0; i < data.length; i++) {
                    var obj = {};
                    obj.Name = data[i].Name;
                    obj.GuidId = data[i].GuidId;
                    obj.Size = data[i].Size;
                    obj.ImageType = data[i].ImageType;
                    obj.Group = data[i].ResponseObject.FDFS_GROUP;
                    obj.Url = data[i].ResponseObject.FDFS_NAME;
                    obj.TypeNo = $("#fileType").val();
                    obj.TypeName = $("#fileType").find("option:checked").text()

                    if (data[i].ImageType == null) {
                        var imgUrl = getFileImg(obj.Name);
                        var odiv = `
                                     <tr>
                                        <td><span class ="font-black">1</span></td>
                                        <td class ="text_lf td-div"><span class ="font-black">${obj.Name}</span></td>
                                        <td><span class ="font-black">${obj.TypeName}</span></td>
                                        <td class ="td-div" style="text-align:center">
                                        <a class ="fileDel" href="javascript:void(0)" style="color:#337ab7;">删除</a>
                                        <input type="hidden" id="updata" data-id="${obj.GuidId}" data-url="${obj.Url}" data-src="${imgUrl}" data-name="${obj.Name}" data-size="${obj.Size}" data-upname="${data[i].UploadName}" data-time="${new Date(formatDateByJson(data[i].UploadDate)).Format("yyyy-MM-dd")}" data-group="${obj.Group}">
                                        </td>
                                    </tr>
                           `
                        $('.fileShow-append').append(odiv);
                    }
                }
            }
        });
    }



    layui.use(['layer', 'form', 'element', 'laypage'], function () {
        var layer = layui.layer, form = layui.form, element = layui.element, $ = layui.jquery, laypage = layui.laypage;

        //数据提交
        $(".save").click(function () {


            layer.msg("操作成功", { time: 1000, icon: 1 }, function () {
                window.location.href = "/ProjectManagement/ConstructionDrawings";
            });


            //var fileDataArray = [];
            //$(".fileShow-append tr:not(.headtr)").each(function (index, item) {
            //    fileDataArray.push({
            //        Name: $(item).find("#updata").data("name"),
            //        GuidId: $(item).find("#updata").data("id"),
            //        Size: $(item).find("#updata").data("size"),
            //        Group: $(item).find("#updata").data("group"),
            //        FilePath: $(item).find("#updata").data("url"),
            //        TypeNo: $(item).find("#updata").data("typeno"),
            //        TypeName: $(item).find("#updata").data("typename"),
            //        Sort: index + 1
            //    })
            //});
            //var fileDataJson = JSON.stringify(fileDataArray);
            //$("#fileDataJsonFile").val(fileDataJson);
            ////对表单进行验证
            //var bv = $('#mainForm').data('bootstrapValidator');
            //bv.validate();

            //$("#State").val($(this).data("state"))//提交或保存的状态值
            //var search = $("form").serialize();
            //if (bv.isValid()) {
            //    $.post("Add", search, function (data) {
            //        if (data.Flag) {
            //            layer.msg("操作成功", { time: 1000, icon: 1 }, function () {
            //                window.location.href = "/TzResearch/Index";
            //            });
            //        } else {
            //            layer.alert(data.Message, { icon: 2 });
            //        }
            //    });
            //}
        });

    });
</script>
